<template>
  <div class="rank">
    <ul>
			<!-- 排行榜 -->
      <li v-for="(item) in paiHangList" :key="item.id" v-on:click="$router.push(`/gedandetail?id=${item.id}`)">
        <div class="img">
					<van-image width="100%" height="100%" :src="item.coverImgUrl"></van-image>
        </div>
        <div class="panels">
          <p>{{item.name}}</p>
        </div>
        <van-icon name="arrow" />
      </li>
    </ul>
  </div>
</template>

<script>
import { getPaihang } from '../../../utils/api'
export default {
  data () {
    return {
			// 排行榜数组
      paiHangList: []
    }
  },
  methods: {
		// 获取排行榜
    async getPaihangFn () {
      let result = await getPaihang();
      if (result.code === 200) {
        this.paiHangList = result.list;
      }
    }
  },
  mounted () {
    this.getPaihangFn();
  }
}
</script>

<style lang="less" scoped>
@import '../../css/vars.less';
	.rank{
		margin-top: 100/50rem;
		ul{
			padding-bottom: 20/50rem;
			margin-bottom: 100/50rem;
			overflow-y: auto;
			overflow-x: hidden;
			li{
				height: 5rem;
				background-color: @backWhite;
				position: relative;
				display: flex;
				align-items: center;
				padding-left: 20/50rem;
				&::after{
					content: '';
					position: absolute;
					bottom: 0;
					left: 20/50rem;
					right: 20/50rem;
					border-bottom: 1px solid #ebedf0;
					transform: scaleY(.5);
					-webkit-transform: scaleY(.5);
				}
				.img{
					width: 200/50rem;
					height: 200/50rem;
					background-color: pink;
					margin-right: 40/50rem;
				}
				.panels{
					p{
						font-size: 35/50rem;
						width: 400/50rem;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}
				.van-icon:before{
					position: absolute;
					right: -1.3rem;
					top: 50%;
					color: #888;
					font-size: 40/50rem;
					transform: translateY(-50%);
				}
			}
		}
	}
</style>